<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/inc::header"/>
<body>
<form class="layui-form" id="customerNotesForm">
    <input name="hotelId" id="hotelId" type="hidden"/>
    <input name="id" id="id" type="hidden"/>
    <br/>
    <div class="layui-form-item" style="margin-left: 20%;">
        <label class="layui-form-label">标题:</label>
        <div class="layui-input-inline">
            <input type="text" name="title" id="title" required
                   autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" id="imgDiv" style="margin-left: 20%;width: 99%">
        <label class="layui-form-label">图片:</label>
    </div>
    <div class="layui-form-item" style="margin-left: 20%;">
        <label class="layui-form-label">内容:</label>
        <textarea name="contents" style="width: 50%;height:300px;" id="contents"
                  class="layui-textarea"></textarea>
    </div>
</form>
<script th:replace="/common/inc::incJs"></script>
<script>
    var id = getQueryString("id");


    $(function () {

        if (id != "") {
            //$("form").loadData('/backend/security/user/getById?id=' + id);
            $.post('/backend/security/customerNotes/getById', {id: id}, function (result) {
                if (result.code < 0) {
                    layer.msg(res.message);
                }
                else {
                    $("#customerNotesForm").loadData(result.body);
                    //$("#img").attr("src", result.body.homePhoto);
                    if (result.body.images != null) {
                        var photoList = result.body.images.split(",");
                        for (var i = 0; i < photoList.length; i++) {
                            $("#imgDiv").append("<div class=\"layui-input-inline\"  style=\"width: 200px;\">\n" +
                                "            <div class=\"image-uploader\" style=\"width: 200px;height:150px\">\n" +
                                "                <div class=\"image-preview\" style=\"width: 200px;height: 150px\">\n" +
                                "                    <div class=\"image\" style=\"width: 200px;height: 150px\">\n" +
                                "                        <img src=\"" + photoList[i] + "\" style=\"width: 200px;height: 150px\" class=\"img_home_photo\">\n" +
                                "                    </div>\n" +
                                "                </div>\n" +
                                "            </div>\n" +
                                "        </div>");
                        }
                    }
                }
            });
        }
    })
</script>
</body>
</html>
